<?php
namespace app\index\controller;
use think\Controller;
use think\Session;
use think\Db;
use app\index\controller\Base;
class Blog extends Base{
	//论坛页面
    public function index(){
	  	$username=Session::get('username');
		$info=db('user')->where('username',$username)->select();
		$this->assign('info',$info);
		$produces=Db::table('produce')->alias('a')
		->join('user b','a.userid=b.id')
		->field('a.pid,a.title,a.author,a.desc,a.keywords,a.content,a.pic,a.click,a.thumb,a.time,a.userid,b.user_city,b.upic')
		->order('a.pid','desc')
		->paginate(10);
		// var_dump($produces);
		// exit;
		$page=$produces->render();
		// var_dump($$page);
		// exit;
		$this ->assign('page',$page);		
		$this->assign('produces',$produces);
		return $this->fetch('blog');
	}
	
	public function logout(){//销毁session
    	session("username", NULL);//跳转页面
    	$this->success('注销成功！','Blog/index');
	}
	
	
}